package belf.migrate.evaluate.type;

import belf.migrate.api.common.DatabaseIdentifier;
import belf.migrate.api.type.LevelType;

public enum PageType {
    MYSQL_DM(DatabaseIdentifier.MYSQL, DatabaseIdentifier.DAMENG, LevelType.ERROR, "虽然达梦数据库也在一定程度上支持类似 MySQL 的分页语法，但由于其原生的分页方式是基于ROWNUM，在将 MySQL 的分页代码移植到达梦数据库时，可能需要对代码进行较多的修改和调整，以适应达梦数据库的分页实现方式。"),
    MYSQL_KINGBASE(DatabaseIdentifier.MYSQL, DatabaseIdentifier.KINGBASE, LevelType.ERROR, "Kingbase 数据库不支持类似 MySQL 的分页语法，需要将分页代码转换为 Kingbase 的分页语法。"),

    ;

    private String sourceCatalogName;

    private String sinkCatalogName;

    private LevelType level;

    private String desc;

    PageType(String sourceCatalogName, String sinkCatalogName, LevelType level, String desc) {
        this.sourceCatalogName = sourceCatalogName;
        this.sinkCatalogName = sinkCatalogName;
        this.level = level;
        this.desc = desc;
    }

    public static PageType getPageType(String sourceCatalogName, String sinkCatalogName) {
        for (PageType pageType : PageType.values()) {
            if (pageType.sourceCatalogName.equals(sourceCatalogName) && pageType.sinkCatalogName.equals(sinkCatalogName)) {
                return pageType;
            }
        }
        return null;
    }

    public String getSourceCatalogName() {
        return sourceCatalogName;
    }

    public void setSourceCatalogName(String sourceCatalogName) {
        this.sourceCatalogName = sourceCatalogName;
    }

    public String getSinkCatalogName() {
        return sinkCatalogName;
    }

    public void setSinkCatalogName(String sinkCatalogName) {
        this.sinkCatalogName = sinkCatalogName;
    }

    public LevelType getLevel() {
        return level;
    }

    public void setLevel(LevelType level) {
        this.level = level;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
